package cn.edu.ecut.synchronize;

import java.time.LocalDateTime;

/**
 */
public class SynchronizationTest5 {

	public static void main(String[] args) throws InterruptedException {
		
		StringBuffer buffer = new StringBuffer();
		
		Thread t = new Thread() {
			@Override
			public void run() {
				buffer.append( LocalDateTime.now() );
			}
		};
		
		Thread h = new Thread() {
			@Override
			public void run() {
				try {
					Thread.sleep( 100 );
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				buffer.setLength(0);
			}
		};
		
		t.start();
		h.start();
		
		Thread.sleep( 1000 );
		
		System.out.println( buffer );

	}

}
